import request from '@/utils/request'

// 查询订单列表
export function listOrder(query) {
  return request({
    url: '/mall/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getOrder(orderId) {
  return request({
    url: '/mall/order/' + orderId,
    method: 'get'
  })
}

// 创建订单
export function createOrder(data) {
  return request({
    url: '/mall/order',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrder(data) {
  return request({
    url: '/mall/order',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delOrder(orderId) {
  return request({
    url: '/mall/order/' + orderId,
    method: 'delete'
  })
}

// 支付订单
export function payOrder(orderId, payMethod) {
  return request({
    url: '/mall/order/' + orderId + '/pay',
    method: 'post',
    data: {
      payMethod: payMethod
    }
  })
}

// 取消订单
export function cancelOrder(orderId) {
  return request({
    url: '/mall/order/' + orderId + '/cancel',
    method: 'post'
  })
}

// 确认收货
export function confirmReceive(orderId) {
  return request({
    url: '/mall/order/' + orderId + '/confirm',
    method: 'post'
  })
} 